package com.fqgj.sentry.policy.client;

import com.fqgj.sentry.policy.domain.rule.RuleAddAndUpdateInfo;
import com.fqgj.sentry.policy.entity.PcExecuteResultEntity;
import com.fqgj.sentry.policy.entity.PcRuleConditionEntity;
import com.fqgj.sentry.policy.entity.PcRuleEntity;
import com.fqgj.sentry.policy.enums.ActiveEnum;

import java.util.List;

/**
 * Created by liupengpeng on 2017/7/28.
 */
public interface RuleService {
    /**
     * 根据 策略id 查询 规则集合
     *
     * @param policyId
     * @return
     */
    List<PcRuleEntity> findRuleListByPolicyId(Long policyId, Integer active, Integer ruleType);

    /**
     * 根据 策略id 查询 规则集合
     *
     * @param policyId
     * @return
     */
    List<PcRuleEntity> findActiveRuleListByPolicyId(Long policyId, Integer ruleType);

    /**
     * 规则 删除
     *
     * @param ruleIds
     * @return
     */
    Boolean deleteRule(List<Long> ruleIds);


    /**
     * 规则 条件查询
     */
    String findRuleCondition(Long ruleId);

    /**
     * 更新 规则 开关
     *
     * @param ruleIds
     * @return
     */
    Boolean updateRuleActive(List<Long> ruleIds, ActiveEnum activeEnum);

    /**
     * 根据 编号查询  倒序排列
     *
     * @param code
     * @retu
     */
    List<PcRuleEntity> findRuleListByCode(String code);


    /**
     * 规则 新增
     *
     * @param addInfo
     * @return
     */
    Boolean addRule(RuleAddAndUpdateInfo addInfo);

    /**
     * 规则 修改
     *
     * @return
     */
    Boolean updateRule(Long ruleId, RuleAddAndUpdateInfo updateInfo);

    /**
     * 根据 商户ID  执行者id 查询
     *
     * @retu
     */
    List<PcRuleEntity> findActiveByPolicySetsIdAndExecutorId(Long policySetsId, Long executorId);

    /**
     * 根据策略集id  查询  规则条件集合
     *
     * @param policyId
     * @return
     */
    List<PcRuleConditionEntity> findRuleConditionByPolicyId(Long policyId);

    /**
     * 查询 全部
     *
     * @return
     */
    List<PcRuleConditionEntity> findAll();

    /**
     * 根据策略id  查询公用规则
     *
     * @param policyId
     * @return
     */
    PcRuleEntity findCommonRuleByPolicy(Long policyId);


    /**
     * 更新 规则排序
     *
     * @param ruleId
     * @param sort
     * @return
     */
    Boolean updateRuleSort(Long ruleId, Integer sort);


    /**
     * 根据规则id  查询规则
     *
     * @param ruleId
     * @return
     */
    PcRuleEntity findById(Long ruleId);

}
